export interface LoginData {
  username: string;
  password: string;
}

export interface Role {
  id: number;
  name: string;
}

export interface Image {
  id: number;
  filename: string;
  filepath: string;
  mimetype: string;
  createdAt: string;
}

export interface LoginRes {
  statusCode: number;
  message: string;
  data: string; // Token
}

export interface Role {
  id: number;
  name: string;
  menus: MenuWrapper[];
}

export interface Menu {
  id: number;
  name: string;
  type: string;
  path: string;
  icon: string | null;
  parentId: number | null;
  roleId: number;
  isProtected: boolean;
  children: Menu[];
}
// 定义菜单包装的结构
export interface MenuWrapper {
  menu: Menu;
}

export interface Image {
  id: number;
  filename: string;
  filepath: string;
  mimetype: string;
  createdAt: string;
}

export interface UserInfo {
  id: number | null;
  username: string;
  role: Role | null;
  image: Image[];
  token: string;
  isAuth: boolean;
  menuTree: Menu[];
  userInfoLoaded: boolean;
}

export interface TableData {
  id: number;
  username: string;
  role: string | any;
  createdAt: string;
}

export interface FormField {
  label: string;
  prop: string;
  type: string;
  inputType?: string;
  options?: any[];
}

export interface RuleForm {
  username: string;
  password?: string;
  confirmPassword?: string;
  role: number;
}

export interface CategoryResponse {
  statusCode: number;
  message: string;
  data: {
    list: Category[];
    total: number;
    totalPages: number;
  };
}
export interface Category {
  id: number;
  name: string;
}
export interface LinksResponse {
  statusCode: number;
  message: string;
  data: {
    list: Link[];
    total: number;
    totalPages: number;
  };
}

export interface Link {
  id: number;
  title: string;
  href: string;
  categoryId: number;
}
